package com.moyq5.permit.center.web.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.moyq5.mvc.framework.general.Body;
import com.moyq5.mvc.framework.general.PageData;
import com.moyq5.permit.center.bean.search.Agent4Search;
import com.moyq5.permit.center.feign.client.AgentFeign;
import com.moyq5.permit.center.web.jackson.filter.AgentFilter;


/**
 * 代理商
 * @author Moyq5
 * @date 2019年7月25日
 */
@RestController
@RequestMapping("/agent")
public class AgentController extends BaseController {
	
	private static Logger log = LoggerFactory.getLogger(AgentController.class);
	
	@Autowired
	private AgentFeign agentFeign;
	
	/**
	 * @author Moyq5
	 * @date 2019年7月25日
	 * @param agent4s
	 * @param pd
	 * @return
	 * @throws JsonProcessingException
	 */
	@GetMapping(value="/page", produces={MediaType.APPLICATION_JSON_UTF8_VALUE})
	@ResponseBody
	public String page(Agent4Search agent4s, PageData pd) throws JsonProcessingException {
		log.debug("查询代理商信息>>>page(Agent4Search, PageData)");
		return toJson(agentFeign.page(new Body<Agent4Search, PageData>(agent4s, pd)), AgentFilter.get());
	}
	
}
